#include<stdio.h>
int main()
{
	float s,p1,p2;
	int t;
	scanf("%f %d",&s,&t);
	p1=t/5*2;
	if(s<=3) p2=10;
	else if(s<=10) p2=10+(s-3)*2;
	else p2=10+(s-10)*3+14;
	printf("%.0f",p1+p2);
	return 0;
}
